# +----------------------------------------------------------------------
# | ChatWork智能聊天办公系统
# +----------------------------------------------------------------------
# | 软件声明: 本系统并非自由软件,未经授权任何形式的商业使用均属非法。
# | 版权保护: 任何企业和个人不允许对程序代码以任何形式任何目的复制/分发。
# | 授权要求: 如有商业使用需求,请务必先与版权所有者取得联系并获得正式授权。
# +----------------------------------------------------------------------
# | Author: ChatWork Team <2474369941@qq.com>
# +----------------------------------------------------------------------
from fastapi import APIRouter, Depends
from hypertext import R, PagingResult, response_json
from apps.admin.schemas.apply.docs import files_schema as schema
from apps.admin.service.apply.docs.files_service import DocsFilesService


router = APIRouter(prefix="/files", tags=["畅阅文件接口"])


@router.get("/lists", summary="文件列表", response_model=R[PagingResult[schema.DocsFilesListVo]])
@response_json
async def lists(params: schema.DocsFilesSearchIn = Depends()):
    return await DocsFilesService.lists(params)


@router.get("/dataset", summary="文件数据", response_model=R[PagingResult[schema.DocsDatasetVo]])
@response_json
async def dataset(params: schema.DocsFilesDatesetIn = Depends()):
    return await DocsFilesService.dataset(params)


@router.post("/delete", summary="文件删除", response_model=R)
@response_json
async def delete(params: schema.DocsFilesIdIn):
    return await DocsFilesService.delete(params.id, params.reason)


@router.post("/retry", summary="文件重试", response_model=R)
@response_json
async def retry(params: schema.DocsFilesIdIn):
    return await DocsFilesService.retry(params.id)
